package com.example.doctor.fragment.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.fragment.app.Fragment
import com.lwkjgf.workplace.R

public abstract class BaseModelFragment: Fragment() {


    lateinit var root:View
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        root = inflater.inflate(getLayoutId(),container,false)
        return root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initView()
        observeModel()
        initData()
    }
    fun initTitle(title:String){
        var back = root.findViewById<ImageView>(R.id.back);
        back.visibility =View.GONE
        var titleName = root.findViewById<TextView>(R.id.titleName);
        titleName.text = title
    }

    override fun onDestroyView() {
        super.onDestroyView()

    }


    protected open fun initData() {
    }


    protected abstract fun getLayoutId(): Int

    protected abstract fun initView()

    protected abstract fun observeModel()





}